﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TopicDetial.aspx.cs" Inherits="Page_Community_TopicDetial" %>



<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta name="format-detection" content="telephone=no" />
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <title>咨询详细</title>
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />


    <script src="../../Scripts/jquery-1.8.0.min.js"></script>
    <script src="../../Scripts/slick.min.js"></script>
    <script src="../../Scripts/viewport.js"></script>
    <link href="../../CSS/community-info.css" rel="stylesheet" />
    <link href="../../CSS/slick.css" rel="stylesheet" />
    <link href="../../CSS/base-640.css" rel="stylesheet" />
    <style>
        .name1, .time1 {
            margin-left: 71px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 28px;
        }
    </style>
</head>
<body>

    <div class="container clearfix">
        <div class="content-list">
            <%if (topicModel != null)
                {%>
            <div class="list">
                <!--  用户信息 -->
                <div class="hd clearfix">
                    <img src="<%=topicModel.HeadImg %>" />
                    <p class="name"><%=topicModel.Name %></p>
                    <p class="date"><%=topicModel.AddTime %></p>
                </div>

                <!-- 关注 -->

                <span class="guanzhu <%=topicModel.IsClosed==0?"":"guanzhu-at" %> " onclick="Attention(<%=topicModel.Id %>,<%=topicModel.IsClosed==0?"true":"false" %>)"><span><%=topicModel.IsClosed==0?"关闭":"已关闭" %></span></span>


                <!--                 <span class="hot"><img src="http://cdn.xsmore.com/Images/bcy/c-hot.png"></span> -->
                <p class="text"><%=topicModel.Contents %></p>

                <!-- 用户图片 -->
                <%if (!string.IsNullOrEmpty(topicModel.imgs))
                    {%>
                <ul class="pic-list clearfix">
                    <% var imgs = topicModel.imgs.Split(',');
                        foreach (var item in imgs)
                        {%>
                    <li>
                        <img style="width: 200px; height: 200px;" src="<%=item %>" />
                    </li>
                    <% } %>
                </ul>
                <% } %>
            </div>
            <% } %>
        </div>

        <div class="comment">
            <ul class="tab clearfix">
                <li class="at"><span>回复</span></li>
            </ul>
            <div class="return-comment">
                <%if (topicReplyList != null)
                    {%><ul id="shareList">
                        <%foreach (var item in topicReplyList)
                            {%>
                        <li class="clearfix content">
                            <img src="<%=item.ReplyHeadImg %>"><p class="name1"><%=item.ReplyName %></p>
                            <p class="time1"><%=item.AddTime %></p>
                            <p class="mes"><%=item.Contents %></p>
                        </li>
                        <% }%>
                    </ul>
                <%}
                    else
                    {%>
                <div class="no_record noneData" style="">
                    <div>
                        <img src="../../Images/no-data-icon.png" /><br>
                        无回复记录
                    </div>
                </div>
                <%} %>
            </div>
        </div>

    </div>

    <!-- 回复转发复制 -->
    <div class="com-menu-layout" style="display: none"></div>
    <div class="com-menu" style="display: none">
        <p class="reply">回复</p>
        <p class="transmit">转发</p>
        <p class="cancel">取消</p>
    </div>


    <!-- 评论弹框 -->
    <div class="comment-tips" id="replyBox" style="display: none">
        <p class="hd">评论</p>
        <textarea placeholder="请输入您的评论" id="txtComment"></textarea>
        <p class="btn clearfix">
            <span class="cancel">取消</span>
            <span class="sure">确定</span>
        </p>
    </div>

    <div class="filter-pic" style="display: none">
        <div class="slick">
            <div>
                <a href="#">
                    <img src="http://cdn.xsmore.com/Images/bcy/c-pic.png" alt=""></a>
            </div>
            <div>
                <a href="#">
                    <img src="http://cdn.xsmore.com/Images/bcy/c-pic.png" alt=""></a>
            </div>
            <div>
                <a href="#">
                    <img src="http://cdn.xsmore.com/Images/bcy/c-pic.png" alt=""></a>
            </div>
            <div>
                <a href="#">
                    <img src="http://cdn.xsmore.com/Images/bcy/c-pic.png" alt=""></a>
            </div>
            <div>
                <a href="#">
                    <img src="http://cdn.xsmore.com/Images/bcy/c-pic.png" alt=""></a>
            </div>
        </div>
    </div>
</body>

<script type="text/javascript">


    //  图片预览
    $(".pic-list li").on("click", function () {

        var img = $("img", this.parentNode),
            len = img.length,
            index = $(this).index();

        if (!img.length) return;

        var html = "";
        img.each(function (i, e) {
            html += '<div><a href="javascript:void(0)"><img src="' + e.src + '" alt=""></a></div>';
        });

        $(".filter-pic").html('<div class="slick">' + html + '</div><div class="number">' + (index + 1) + "/" + len + '</div>').show();

        var slick = $('.slick').slick({
            dots: false,
            onAfterChange: function (e, index) {
                $(".filter-pic .number").html((index + 1) + "/" + len);
            }
        });

        slick.slickGoTo(index);

    });

    $(".filter-pic").on("click", function () {
        $(this).hide();
    });

    //点击黑色遮罩或者取消按钮，关闭所有弹框
    $(".com-menu-layout, .com-menu .cancel").on("click", function () {


        $(".com-menu").animate({ "bottom": "-400px" }, 300, function () {
            $(".com-menu-layout,.com-menu").hide();
        });

        replyHide();

        transmitHide();

    });

    //点击回复弹出回复框
    $(".com-menu .reply").on("click", function () {

        $(".com-menu").animate({ "bottom": "-400px" }, 300, function () {
            $(".com-menu").hide();
        });

        $("#replyBox").show().css({
            "transform": "scale(1)",
            "-webkit-transform": "scale(1)"
        });
    });

    //回复框取消按钮
    $("#replyBox .cancel").on("click", function () {
        replyHide();
    });

    //回复框确定按钮
    $("#replyBox .sure").on("click", function () {
        var comment = $("#txtComment").val();
        $.post("/Handler/CommunityHandler.ashx?action=AddComment", { content: comment,topicId:<%=topicId%>,openid:'<%=openid%>' }, function (result) {
            alert("评论成功");
            replyHide();
            location.reload();
        });
       
    });

    //回复弹框消失动画
    function replyHide() {
        $("#replyBox").css({
            "transform": "scale(0)",
            "-webkit-transform": "scale(0)"
        });
        setTimeout(function () {
            $(".com-menu-layout").hide();
        }, 500);
    }

</script>

<script type="text/javascript">
    //评论
    $(".content").click(function () {
        $(".com-menu-layout").show();
        $(".com-menu").animate({ "bottom": "-400px" }, 300, function () {
            $(".com-menu").hide();
        });

        $("#replyBox").show().css({
            "transform": "scale(1)",
            "-webkit-transform": "scale(1)"
        });
    });


    //关注
    function Attention(topicId,flag) {
        $.post("/Handler/CommunityHandler.ashx?action=CloseTopic",  { TopicId: topicId,Flag:flag },function (data) {
            $(".guanzhu").toggleClass("guanzhu-at");
            $(".guanzhu").attr("onclick", "Attention(" + topicId + "," + !flag + ")");
            if (!flag) {
                $(".guanzhu").html("<span>关闭</span>");
            } else {
                $(".guanzhu").html("<span>已关闭</span>");
            }
        });
    }




</script>

</html>
